package cn.iocoder.yudao.module.shop.dal.mysql.dayuser;

import java.time.LocalDateTime;
import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.dayuser.ShopDayUserDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.dayuser.vo.*;

/**
 * 艾灸师每日统计 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface ShopDayUserMapper extends BaseMapperX<ShopDayUserDO> {

    default PageResult<ShopDayUserDO> selectPage(ShopDayUserPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopDayUserDO>()
                .eqIfPresent(ShopDayUserDO::getDateId, reqVO.getDateId())
                .eqIfPresent(ShopDayUserDO::getUserId, reqVO.getUserId())
                .betweenIfPresent(ShopDayUserDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopDayUserDO::getId));
    }

    default List<ShopDayUserDO> selectList(ShopDayUserExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShopDayUserDO>()
                .eqIfPresent(ShopDayUserDO::getDateId, reqVO.getDateId())
                .eqIfPresent(ShopDayUserDO::getUserId, reqVO.getUserId())
                .betweenIfPresent(ShopDayUserDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopDayUserDO::getId));
    }

    default  List<ShopDayUserDO> selectList(LocalDateTime startTime, LocalDateTime endTime, Long tenantId){
        return selectList(new LambdaQueryWrapperX<ShopDayUserDO>()
                .eq(ShopDayUserDO::getTenantId, tenantId)
                .between(ShopDayUserDO::getCreateTime, startTime, endTime));
    }

    default List<ShopDayUserDO> selectListByUserId(String dateRight, Long userId){
        return selectList(new LambdaQueryWrapperX<ShopDayUserDO>()
                .likeRight(ShopDayUserDO::getDateId, dateRight)
                .eq(ShopDayUserDO::getUserId, userId));
    }

}
